package club.easin.sq.ctl;

import club.easin.common.DatagridRequestDto;
import club.easin.pow.dto.UserSession;
import club.easin.sq.bl.Maintainbl;
import club.easin.sq.dto.MaintainQueryDto;
import club.easin.sq.dto.SqMaintain;
import club.easin.utils.ReturnDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("maintain")
public class MaintainCtl {

    @Autowired
    private Maintainbl maintainbl;

    @RequestMapping("addMaintain")
    @ResponseBody
    public ReturnDto addMaintain(UserSession userSession,@RequestBody SqMaintain sqMaintain){
        return maintainbl.addManintain(userSession,sqMaintain);
    }

    @RequestMapping("delMaintain")
    @ResponseBody
    public ReturnDto delMaintain(UserSession userSession,String mainid){
        return maintainbl.delManintain(mainid);
    }

    @RequestMapping("editMaintain")
    @ResponseBody
    public ReturnDto editMaintain(UserSession userSession,@RequestBody SqMaintain sqMaintain){
        return maintainbl.updateManintain(sqMaintain);
    }

    @RequestMapping("maintainGrild")
    @ResponseBody
    public ReturnDto maintainGrild(UserSession userSession, @RequestBody DatagridRequestDto<MaintainQueryDto> dto){
        return maintainbl.getMaintainGrild(dto);
    }

    @RequestMapping("checkPass")
    @ResponseBody
    public ReturnDto checkPass(UserSession userSession,String mainid){
        return maintainbl.mainCheckPass(userSession,mainid);
    }

    @RequestMapping("checkNoPass")
    @ResponseBody
    public ReturnDto checkNoPass(UserSession userSession,String mainid){
        return maintainbl.mainCheckNoPass(userSession,mainid);
    }
}
